@import "../common/vars.scss"; //配置文件
@import "../mixins/mixins.scss"; //函数文件
//隐藏原始的
.aiui-form input[type="radio"] {
  display: none;
}
@include create(radio) {
  color: $radio-color;
  font-weight: $radio-font-weight;
  line-height: 1;
  position: relative;
  cursor: pointer;
  display: inline-block;
  white-space: nowrap;
  outline: none;
  font-size: $font-size-base;
  //带边框
  @include when(bordered) {
    padding: $radio-bordered-padding;
    border-radius: $border-radius-base;
    border: $border-base;
    box-sizing: border-box;
    height: $radio-bordered-height;
    background: $fill-base;
    &.is-checked {
      border-color: $color-primary;
    }
    &.is-disabled {
      cursor: not-allowed;
      border-color: $border-color-lighter;
    }
  }

  & + & {
    margin-left: 10px;
  }
  //input样式
  @include e(input) {
    white-space: nowrap;
    cursor: pointer;
    outline: none;
    display: inline-block;
    line-height: 1;
    position: relative;
    vertical-align: middle;
  }

  //input-inner样式
  @include e(input-inner) {
    border: $radio-input-border;
    border-radius: $radio-input-border-radius;
    width: $radio-input-width;
    height: $radio-input-height;
    background-color: $radio-input-fill;
    position: relative;
    cursor: pointer;
    display: inline-block;
    box-sizing: border-box;
    &:hover {
      border-color: $radio-input-border-color-hover;
    }

    &::after {
      width: 4px;
      height: 4px;
      border-radius: $radio-input-border-radius;
      background-color: $color-white;
      content: "";
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%) scale(0);
      transition: transform 0.15s ease-in;
    }
  }

  //禁用样式
  @include when(disabled) {
    .aiui-radio-input-inner {
        background-color: $radio-disabled-input-fill;
        border-color: $radio-disabled-input-border-color;
        cursor: not-allowed;

        &::after {
          cursor: not-allowed;
          background-color: $radio-disabled-icon-color;
        }

        & .aiui-radio-label {
          cursor: not-allowed;
        }
      }
      &.is-checked {
        .aiui-radio-input-inner {
          background-color: $radio-disabled-checked-input-fill;
          border-color: $radio-disabled-checked-input-border-color;

          &::after {
            background-color: $radio-disabled-checked-icon-color;
          }
        }
      }
      & span.aiui-radio-label {
        color: $color-text-placeholder;
        cursor: not-allowed;
      }
  }

  //选中样式
  @include when(checked) {
    .aiui-radio-input-inner {
        border-color: $radio-checked-input-border-color;
        background: $radio-checked-icon-color;

        &::after {
          transform: translate(-50%, -50%) scale(1);
        }
      }

      & .aiui-radio-label {
        color: $radio-checked-text-color;
      }
  }

  &:focus:not(.is-focus):not(:active):not(.is-disabled) {
    /*获得焦点时 样式提醒*/
    .aiui-radio-input-inner {
      box-shadow: 0 0 2px 2px $radio-input-border-color-hover;
    }
  }

  @include e(label) {
    font-size: $radio-font-size;
    padding-left: 10px;
  }
}
@include create(radio-group){
    display: inline-block;
    line-height: 1;
    vertical-align: middle;
    font-size: 0;
    .aiui-radio{
      margin: 0px;
      border-radius: 0px;
      border-right: none;
      .aiui-radio-input{
        display: none;
      }
      @include when(checked){
        background: $radio-group-radio-backgroud;
        .aiui-radio-label{
          color: $color-white;
        }
        & + .aiui-radio{
          border-left-color: $color-white;
        }
      }
      &:first-child{
        border-top-left-radius: $border-radius-base;
        border-bottom-left-radius: $border-radius-base;
      }
      &:last-child{
        border-top-right-radius: $border-radius-base;
        border-bottom-right-radius: $border-radius-base;
        border-right: $border-base;
      }
      @include when(disabled){
        background:$fill-base;
        .aiui-radio-label{
          color: $color-text-placeholder;
        }
        &+.aiui-radio{
          border-color: $border-color-lighter;
        }
      }
    }
    
}